﻿#ifndef __W32_CONTEXT_H__
#define __W32_CONTEXT_H__

#include "fwPlatformContext.h"

#if CURRENT_PLATFORM == PLATFORM_WIN32
//==================================================================//
//===========================>WINDOWS<==============================//
//==================================================================//

/// esCreateWindow flag - RGB color buffer
#define ES_WINDOW_RGB           0
/// esCreateWindow flag - ALPHA color buffer
#define ES_WINDOW_ALPHA         1 
/// esCreateWindow flag - depth buffer
#define ES_WINDOW_DEPTH         2 
/// esCreateWindow flag - stencil buffer
#define ES_WINDOW_STENCIL       4
/// esCreateWindow flat - multi-sample buffer
#define ES_WINDOW_MULTISAMPLE   8

class _DLL_LIB_API Win32Context : public PlatformContext
{
private:
	const char* m_szTitle;				//Windows title
	int m_iFlags;						//Parameter for create
	int m_iWidth;						//Windows width
	int m_iHeight;						//Windows height

	EGLNativeWindowType m_eglHWND;		//Windows handler
	EGLDisplay m_eglDisplay;			//EGL Display
	EGLContext m_eglContext;			//EGL Context
	EGLSurface m_eglSurface;			//EGL Surface
private:
	EGLBoolean w32CreateWindows();								//Create windows game
	EGLBoolean w32CreateESContext(EGLint[]);					//Create OpenGLES context data
	EGLBoolean w32CreateClientWindows();						//Create windows view
	static LRESULT w32WindowsProc(HWND, UINT, WPARAM, LPARAM);	//Process windows message
public:
	//Constructo, Destructor
	Win32Context(int iWidth, int iHeight, char* szTitle, int iFlag);
	Win32Context() : Win32Context(900, 450, "Game view", 0){}
	~Win32Context(){};
public: //Override abstract method
	virtual int Init();
	virtual void Destroy();
	virtual void Run();
};

#endif

#endif